﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.Logging;
using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Unity;
using Models;
using Views;
using ViewModels;
using Interfaces;

namespace Modules
{
    public class ChartModule : IModule
    {
        private readonly IRegionManager _regionManager;
        private readonly IUnityContainer _container;
        private readonly ILoggerFacade _logger;

        public ChartModule(ILoggerFacade logger, IRegionManager regionManager, IUnityContainer container)
        {
            _regionManager = regionManager;
            _container = container;
            _logger = logger;
        }

        public void Initialize()
        {
            _container.RegisterType(typeof(IChartModel), typeof(ChartModel));
            _container.RegisterType(typeof(IChartViewModel), typeof(ChartViewModel));
            _container.RegisterType(typeof(IView), typeof(ChartCandlestickView), "ChartCandlestickView");
            _container.RegisterType(typeof(IView), typeof(ChartMovingAverageView), "ChartMovingAverageView");

            _regionManager.RegisterViewWithRegion("ChartMainRegion", typeof(ChartMainView));
            _regionManager.RegisterViewWithRegion("ChartControlRegion", typeof(ChartControlView));
            _regionManager.RegisterViewWithRegion("ChartHeaderRegion", typeof(ChartHeaderView));
            _regionManager.RegisterViewWithRegion("ChartDataRegion", typeof(ChartGridView));
        }
    }
}
